import Vue from 'vue'
import VueRouter from 'vue-router'

const Login = () => import(/* webpackChunkName: "Login" */ 'views/registerLog/Login.vue');
const ResetPassword = () => import(/* webpackChunkName: "ResetPassword" */ 'views/registerLog/ResetPassword.vue');
const Layout = () => import(/* webpackChunkName: "Layout" */ 'components/layout/Layout.vue');

// 我的下级
const SubordinateAgents = () => import(/* webpackChunkName: "SubordinateAgents" */ 'views/mySubordinate/SubordinateAgents.vue');
const SubMerchants = () => import(/* webpackChunkName: "SubMerchants" */ 'views/mySubordinate/SubMerchants.vue');
// 招募中心
const RecruitingAgents = () => import(/* webpackChunkName: "RecruitingAgents" */ 'views/recruitmentCenter/RecruitingAgents.vue');
const RecruitingMerchants = () => import(/* webpackChunkName: "RecruitingMerchants" */ 'views/recruitmentCenter/RecruitingMerchants.vue');
const RecruitingRetoucher = () => import(/* webpackChunkName: "RecruitingRetoucher" */ 'views/recruitmentCenter/RecruitingRetoucher.vue');

Vue.use(VueRouter)

const routes = [
  {  
    path: '/',
    name: 'index',
    component: Layout,
    redirect: { name: 'mySubordinate'},
  },

  {  
    path: '/recruitmentCenter',
    name: 'recruitmentCenter',
    component: Layout,
    redirect: { name: 'RecruitingAgents'},
    children: [
      // 招募中心
      {
        path: '/RecruitingAgents',
        name: 'RecruitingAgents',
        component: RecruitingAgents,
      },
      {
        path: '/RecruitingMerchants',
        name: 'RecruitingMerchants',
        component: RecruitingMerchants,
      },
      {
        path: '/RecruitingRetoucher',
        name: 'RecruitingRetoucher',
        component: RecruitingRetoucher,
      }
    ]
  },

  {  
    path: '/mySubordinate',
    name: 'mySubordinate',
    component: Layout,
    redirect: { name: 'SubordinateAgents'},
    children: [
      // 我的下级
      {
        path: '/SubordinateAgents',
        name: 'SubordinateAgents',
        component: SubordinateAgents,
      },
      {
        path: '/SubMerchants',
        name: 'SubMerchants',
        component: SubMerchants,
      },
    ]
  },

  // 登录
  {
    path: '/Login',
    name: 'Login',
    component: Login,
  },
  // 登录
  {
    path: '/ResetPassword',
    name: 'ResetPassword',
    component: ResetPassword,
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
